package com.example.testspringwebflux;

import org.apache.catalina.startup.Tomcat;
import org.springframework.boot.web.embedded.tomcat.TomcatWebServer;

/**
 * TomcatSever
 *
 * @author xule
 * @since 2024/07/08
 */
public class TomcatSeverMain {
    public static void main(String[] args) {
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8081);
        tomcat.addContext("/base", null);
        TomcatWebServer server = new TomcatWebServer(tomcat);
        server.start();

        Runtime.getRuntime().addShutdownHook(new Thread(()-> {
            System.out.println("closed");
            server.stop();
        }));
    }
}
